package com.syxp.pda.core.command;

import java.util.ArrayList;
import java.util.List;

import com.syxp.pda.core.bean.FieldBean;
import com.syxp.pda.core.web.PagingBean;

public class QueryFilter {


	private PagingBean pagingBean ;

	private List<String> orderProperty = new ArrayList<String>() ;
	
	private List<CriteriaCommand> criterias = new ArrayList<CriteriaCommand>() ;
	
	public List<CriteriaCommand> getCriterias() {
		return criterias;
	}

	public void setCriterias(List<CriteriaCommand> criterias) {
		this.criterias = criterias;
	}

	public PagingBean getPagingBean() {
		return pagingBean;
	}

	public void setPagingBean(PagingBean pagingBean) {
		this.pagingBean = pagingBean;
	}

	public void buildPagdingBean(int start,int limit){
		this.pagingBean = new PagingBean(start,limit) ;
	}

	public List<String> getOrderProperty() {
		return orderProperty;
	}

	public void setOrderProperty(List<String> orderProperty) {
		this.orderProperty = orderProperty;
	}

	public void addExample(Object obj){
		this.getCriterias().add(new ExampleCommand(obj)) ;
	}
	
	public void addFilter(FieldBean field) {
		this.getCriterias().add(new FieldCommand(field));
	}
	
	public void addProject(List<FieldBean> projections) {
		this.getCriterias().add(new ProjectionCommand(projections)) ;
	}
}
